Skip to content

feat(nav3): [Part 9] Add the built-in SerialNameAndProperties mapper - #6706

Open
0xadam-brown wants to merge 6 commits into
feat/nav3-serial-name-mappers-8from
feat/nav3-serial-name-mappers-9
Open

0xadam-brown wants to merge 6 commits into
feat/nav3-serial-name-mappers-8from
feat/nav3-serial-name-mappers-9

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Nav3 Serial Name Mappers)


📜 Description

BackStackEntryMapper.SerialNameAndProperties lets an application opt into recording serializable route properties alongside destination names. That gives navigation reports useful context without requiring a custom mapper for each route, while keeping the resulting arguments subject to the same back stack limits as custom output.

Before collecting properties, the mapper checks that the app’s serialization runtime can encode a known fixture correctly. If the check throws or produces unexpected output, it disables property collection while continuing to record destination names. This avoids presenting incorrect arguments as useful route context.

A nonfatal property encoding failure preserves the destination's name and records why its arguments were dropped. This keeps navigation identity useful even when a particular route's diagnostic data cannot be represented.

💡 Motivation and Context

Let's host apps that want to serialize back stack entry names and properties easily do so.

addresses: JAVA-787 (link)

💚 How did you test it?

Nav3 release build and all 872 unit tests passed. Repository-wide make format api, Spotless checks, ABI validation, and Detekt passed. The full suite also passed against serialization 1.13.0.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

Continue with PR 10: Demonstrate the built-in mappers.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against a6a8dad

@sentry

sentry Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.65.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: not classified

For commit a6a8dad.

The last run ended with status provider_error, so this pull request has no risk label.

… the encoder

The built-in SerialNameAndProperties mapper's compatibility probe treated only a
LinkageError from the property encoder as conclusive; any other failure was
inconclusive and property encoding proceeded anyway. An API-incompatible
kotlinx.serialization version can fail the encoder without a LinkageError (for
instance, a NullPointerException under R8), so the probe passed and the mapper
went on to record wrong arguments.

Now any failure of the encode probe disables property encoding and keeps names,
since recording wrong arguments is worse than recording none.
… corruption

The property-encoding compatibility probe ran the encoder but ignored its output,
so a binary-incompatible kotlinx.serialization version that links and runs yet
mis-encodes under R8 (observed renaming {id=1} to {value=1} and dropping a route
as a duplicate key) passed the probe, and the mapper then recorded wrong
arguments.

The probe now compares the encoded ProbeClass fixture to its known-good output
and disables property encoding when they differ, keeping names. The mismatch
signal carries only a fixed message, never route data.
The encoding probe's broad catch passed LinkageErrors to
ExceptionUtils.rethrowIfFatal, which rethrows them. The error then escaped the
mapper's constructor, and BuiltInBackStackEntryMappers fell back to a mapper that
records no names, instead of only disabling property encoding.

The probe now returns a LinkageError before the fatal-error check, so an encoder
that can't link keeps names and records encoding_failed, as other encoder
failures do.
@github-actions github-actions Bot removed the risk: medium PR risk score: medium label Nov 20, 2026
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Nav3 Mappers 9] Add SerialNameAndProperties feat(nav3): [Part 9] Add SerialNameAndProperties Nov 20, 2026
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 9] Add SerialNameAndProperties feat(nav3): [Part 9] Add the built-in SerialNameAndProperties mapper Nov 20, 2026
@0xadam-brown
0xadam-brown marked this pull request as ready for review November 20, 2026 15:38
@0xadam-brown
0xadam-brown requested review from a team and adinauer as code owners November 20, 2026 15:38
@0xadam-brown
0xadam-brown requested review from runningcode and removed request for a team November 20, 2026 15:38
@0xadam-brown
0xadam-brown requested a review from romtsn November 20, 2026 15:38
@0xadam-brown 0xadam-brown added the sanity-check PR needs a lightweight review for obvious issues label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant